<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../style/fjol_style.css"/>
		<link rel="stylesheet" type="text/css" href="../style/xol_style.css"/>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav newbgRed">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">修改个人信息</h1>
		</header>
		<div class="mui-content mt10">
		    <div class="mui-input-row p10">
		        <input type="text" placeholder="用户名" id="userName">
		    </div>
		    <div class="p10">
		    	<button type="button" class="mui-btn newbgRed white" style="width: 100%;" onclick="submitChange()">提交</button>
		    </div>
		    
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/common.util.js"></script>
		<script src="../js/enum.util.js"></script>
		<script language='javascript' src='../js/md5.js'></script>
		<script src="../js/network.js"></script>
		
		<script type="text/javascript">
			mui.init();
			var _clientId;
			var userInfo = common.myStorage.getItem('userInfo');
			mui.plusReady(function(){
//				console.log(JSON.stringify(userInfo));
				var wv = plus.webview.currentWebview();
				var personName = wv.personName;
				_clientId = wv.clientId;
				document.querySelector('#userName').value = personName;
			});
			function submitChange(){
				var _realName = document.querySelector('#userName').value;
				var param = [{
					key:'clientId',
					value:_clientId
				},{
					key:'realname',
					value:_realName
				}];
				fjNetwork.post('fjzx/client/edit-client-info.json',param,function(data){
					
					mui.toast(data.msg);
					userInfo.realname = _realName;
					common.myStorage.setItem('userInfo',userInfo);
//					console.log(common.myStorage.getItem('userInfo').realname);
					var wobj = plus.webview.getWebviewById("my_page");
					wobj.reload(true);
					mui.back();
				},function(msg){
					mui.toast(msg);
				})
			}
		</script>
	</body>

</html>